<%--
 * list.jsp
 *
 * Copyright (C) 2013 Universidad de Sevilla
 * 
 * The use of this project is hereby constrained to the conditions of the 
 * TDG Licence, a copy of which you may download from 
 * http://www.tdg-seville.info/License.html
 --%>

<%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>

<%@taglib prefix="jstl"	uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@taglib prefix="security" uri="http://www.springframework.org/security/tags"%>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<%@taglib prefix="acme" tagdir="/WEB-INF/tags" %>


<display:table pagesize="5" class="displaytag" 
name="galleries" requestURI="${URI}" id="row">

	<!-- Attributes -->
	
	<spring:message code="gallery.title" var="titleHeader" />
	<display:column property="title" title="${titleHeader}" sortable="true" />
	
	
	<jstl:if test="${URI ==\"/gallery/list.do\" || URI == \"/gallery/customer/list.do\"}">
	<spring:message code="gallery.paintings" var="paintings"/>
	<display:column title="${paintings}" sortable="false">
			<input type="button" name="paintings"
				value="${paintings}"
				onclick="javascript: window.location.replace('painting/listInGallery.do?galleryId=${row.id}')" />
	</display:column>

	</jstl:if>
	
	<security:authorize access="hasRole('CUSTOMER')">
	
	<jstl:if test="${URI == \"/gallery/customer/listToChoose.do\"}">
	<display:column>
		<spring:message code="gallery.choose" var="choose"/>
		<input type="button" name="choose"
			value="${choose}"
			onclick="javascript: window.location.replace('painting/customer/addToGallery.do?paintingId=${painting.id}&galleryId=${row.id}')" />
	</display:column>
	</jstl:if>
	
	<jstl:if test="${URI == \"/gallery/customer/list.do\"}">	
	<display:column>
		<spring:message code="gallery.delete" var="delete"/>
		<input type="button" name="delete"
			value="${delete}"
			onclick="javascript: window.location.replace('gallery/customer/delete.do?galleryId=${row.id}')" />
	</display:column>
	</jstl:if>
	</security:authorize>
</display:table>

<security:authorize access="hasRole('CUSTOMER')">
<jstl:if test="${URI == \"/gallery/customer/list.do\"}">	
<div>
	<a href="gallery/customer/create.do"> 
		<spring:message	code="gallery.create" />
	</a>
</div>
</jstl:if>
</security:authorize>